package com.qm.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 @author james
 @create 2021-05-01 20:23
 */
public class UuidUtil {

    /**
     * 获得唯一订单号
     */
    public static String getUniqueOrder() {
        SimpleDateFormat format = new SimpleDateFormat("YYYYMMddHHmmss");
        String format2 = format.format(new Date());
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if(hashCodeV < 0) {
            //有可能是负数
            hashCodeV = - hashCodeV;
        }
        return "pk"+format2+String.format("%012d", hashCodeV);
    }
}
